import { Menu } from './Menu';
import { Column, Entity, JoinTable, ManyToMany, PrimaryGeneratedColumn } from "typeorm"
import { User } from './User';

@Entity("sys_role")
export class Role {
    @PrimaryGeneratedColumn()
    id: number
    @Column(
        {
            name: "role_name",
            nullable: true
        }
    )
    roleName: string
    @Column({
        name: "role_desc",
        nullable: true
    })
    roleDesc: string
    @Column(
        {
            name: 'data_status',
            nullable: true
        }
    )
    dataStatus: number
    @Column({
        name: "create_time",
    })
    createTime: Date
    @Column({
        name: "update_time",
    })
    updateTime: Date
    @ManyToMany(() => Menu)
    @JoinTable()
    menus: Menu[]
    @ManyToMany(() => User, (user) => user.roles)
    users: User[]
}
